package mylab.starters.sms;

import mylab.starters.sms.model.SmsData;
import mylab.starters.sms.model.SmsResponse;
import mylab.utils.spring.spi.SpiTemplate;

import java.util.Collection;
import java.util.Collections;

public interface SmsTemplate extends SpiTemplate {

    /**
     * 发送单个短信
     *
     * @param smsData
     * @param phoneNumber
     * @return
     */
    default SmsResponse sendSms(SmsData smsData, String phoneNumber) {
        if (phoneNumber == null || phoneNumber.length() == 0) {
            return new SmsResponse();
        }
        return this.sendSms(smsData, Collections.singletonList(phoneNumber));
    }

    /**
     * 群发发送短信
     *
     * @param smsData
     * @param phoneNumbers
     * @return
     */
    SmsResponse sendSms(SmsData smsData, Collection<String> phoneNumbers);

}
